const _ = require("lodash");

// ------------------------------------------------------------------------------------

// const arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k']
// const temp = arr.slice

// arr.forEach((item, index) => {
//   const temp = arr.slice(0, index)
//   if (temp.length) {
//     console.log(arr[index - 1])
//   }
// })

// ------------------------------------------------------------------------------------

const historyData = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"];
const windowSize = 4;

for (let i = windowSize; i < historyData.length; i++) {
  const windowData = historyData.slice(i - windowSize, i);
  const actual = historyData[i];
  console.log(windowData, actual);
}

// const latestWindowData = historyData.slice(-windowSize);

// console.log(latestWindowData)

// ------------------------------------------------------------------------------------
// const historyData = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"];

// const slidingPairs = _.range(0, historyData.length - 1).map(i => {
//   return historyData.slice(i, i + 2);
// });

// console.log(slidingPairs)

// ------------------------------------------------------------------------------------


// const arr = [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1];
// console.log(arr.length)
// for (let i = 0; i < arr.length; i++) {
//   const temp = arr.slice(0, i);

//   console.log(i, temp.length)
// }
